package com.design.解释器模式;

public class TestMain {

	public static void main(String[] args) {
		
		Expression r = new TerminalExpression("Robert");
		Expression j = new TerminalExpression("John");
		Expression orEx = new OrExpression(r, j);
		
		Expression r1 = new TerminalExpression("1");
		Expression j1 = new TerminalExpression("1");
		Expression andEx = new OrExpression(r1, j1);
		
		System.out.println("John is male "+orEx.interpret("John"));
		System.out.println("Julie is male "+andEx.interpret("1"));
		
	}
	
}
